package com.svse.util;

import com.alibaba.fastjson.JSONObject;

import java.util.Optional;

/**
 * @author LiYuhang
 * @version 0.1
 * @application
 * @Copyright 上海危网信息科技有限公司版权所有
 * @company wwsoft
 * @Date 2020/5/11 14:48
 */
public class UtilS {

    public String getStringByKey(JSONObject object,String key){
        return Optional.ofNullable(getStr(object,key)).orElse("");
    }

    public String getStringByKey(JSONObject object,String key,String other){
        return Optional.ofNullable(getStr(object,key)).orElse(other);
    }

    public String getStr(JSONObject object,String key){
        return object.getString(key);
    }
}

